package com.aratek.huwai.dao;

import com.aratek.huwai.model.DishEntity;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author 姜寄羽
 * 料理保存相关
 * @Date 2018/1/22 17:27
 */
public interface DishRepository extends CrudRepository<DishEntity,Integer> {

    AtomicInteger KEY  = new AtomicInteger(1);

    int countByTable(Integer table);

    @Modifying
    @Query("delete from DishEntity t where t.table = ?1")
    int deleteDishEntitiesByTableEquals(Integer table);

}
